docker-compose.yml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| version: "3" services: mqtt: image: emqx/emqx:4.2.14 container_name: mqtt restart: always ports: - "1883:1883" - "8083:8083" volumes: - /etc/timezone:/etc/timezone - /etc/localtime:/etc/localtime environment: - EMQX_LOADED_PLUGINS="emqx_recon,emqx_retainer,emqx_management,emqx_auth_username" - EMQX_ALLOW_ANONYMOUS=false - EMQX_AUTH__USER__1__USERNAME=${MQTT_USERNAME:-username} - EMQX_AUTH__USER__1__PASSWORD=${MQTT_PASSWORD:-password}
|
启动
docker-compose up -d
nginx 代理设置
1 2 3 4 5 6 7 8 9 10
| location /mqtt { proxy_pass http://192.168.31.186:8083; # 局域网ip地址 proxy_read_timeout 60s; proxy_set_header Host $host; proxy_set_header X-Real_IP $remote_addr; proxy_set_header X-Forwarded-for $remote_addr; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection Upgrade; }
|
版权声明: 此文章版权归houxiaozhao所有,如有转载,请注明来自原作者
houxiaozhao
houxiaozhao的技术博客,专注于前端开发、Node.js、Web技术和JavaScript编程。分享技术心得,探讨开发经验,致力于提供高质量的技术文章和解决方案。
Follow Me